package com.rd.student.jike.class2.lihongming.Solutions5;

import java.io.File;
import java.util.Scanner;

/**
 * @Auther:Heinrich
 * @Date:2023/7/31-07-31-10:39
 * @Description:com.rd.student.jike.class2.lihongming.Solutions5
 * @version:1.0
 */
public class Question2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入要查看目录的路径");
        String path = scanner.nextLine();
        File file = new File(path);
        listAll(file);
    }
    public static void listAll(File file) {
        File[] files = file.listFiles();
        if (files == null || files.length == 0) return;
        for (File tmpFile : files) {
            System.out.println(file.getName()+" : "+tmpFile.getName());
            if (tmpFile.isDirectory()) {
                listAll(tmpFile);
            }
        }
    }
}
